import React,{Component} from 'react'

class B extends Component{
    render(){
        return <div>
             {this.props.txt}
        </div>
    }
}

B.defaultProps ={
    txt:'i am B'
}

export default class A extends Component{
    state={
        txt:'hello world'
    }
    render(){
        return <div>
            <B txt={this.state.txt}></B>
        </div>
    }
}